<%-- 
    Document   : formDetails
    Created on : Dec 18, 2010, 8:56:30 AM
    Author     : navneet
--%>

<%@page import="com.myapp.global.user_listclass"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<%
    user_listclass ulc = new user_listclass();
%>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Web-Dev-Tool by Navneet Kumar</title>
        <meta http-equiv="Content-Language" content="English" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="css/style1.css" media="screen" />
        <script type="text/javascript" src="js/javascript4.js" ></script>
        <script type="text/javascript" src="js/javascript_front2.js" ></script>
        <script type="text/javascript">
            var page        = 1;
            var sortby      = 1;
            var sortas      = 1;
            var search      = 0;
            var searchfor   = 0;
            document.onloaded = getoverview();

            function getoverview(){
                var params = '';
                params += '&page='+page;
                params += '&sortby='+sortby;
                params += '&sortas='+sortas;
                params += '&search='+search;
                params += '&searchfor='+searchfor;
                getaddon("ajax/common.jsp?","doOn=formDetails&doThis=1"+params,"tabs","getoverview_cbk");
            }
            function getoverview_cbk()
            {
                //getObject("neetProcessingDivtabsData").style.display = 'none';
            }
            function getGroupCompanies(id)
            {
                getObject("neetProcessingDivGroupedComp1").style.display = '';
                getaddon("ajax/common.jsp?","doOn=formDetails&doThis=2&GroupFilter="+id,"companyCombo_div","getGrpComp_cbk");
            }
            function getGrpComp_cbk()
            {
                getObject("neetProcessingDivGroupedComp1").style.display = 'none';
            }
            function getCompanySites(id)
            {
                var param = "doOn=formDetails&doThis=3&CompanyFilter="+id;
                getObject("neetProcessingDivGroupedComp2").style.display = '';
                getaddon("ajax/common.jsp?",param,"sitesCombo_div","getCompSt_cbk");
            }
            function getCompSt_cbk()
            {
                getObject("neetProcessingDivGroupedComp2").style.display = 'none';
            }
            function getSiteEntity(id)
            {
                var param = "doOn=formDetails&doThis=4&SiteFilter="+id;
                getObject("neetProcessingDivGroupedComp3").style.display = '';
                getaddon("ajax/common.jsp?",param,"EntityCombo_div","getStEntity_cbk");
            }
            function getStEntity_cbk()
            {
                getObject("neetProcessingDivGroupedComp3").style.display = 'none';
            }
            function getEntityForms(id){
                var param = "doOn=formDetails&doThis=5&EntityFilter="+id;
                getObject("neetProcessingDivGroupedComp4").style.display = '';
                getaddon("ajax/common.jsp?",param,"FormCombo_div","getEntityFrm_cbk");
            }
            function getEntityFrm_cbk()
            {
                getObject("neetProcessingDivGroupedComp4").style.display = 'none';
            }
            function getFormFields(id){
                var param = "doOn=formDetails&doThis=6&FormFilter="+id;
                getObject("neetProcessingDivGroupedComp5").style.display = '';
                getaddon("ajax/common.jsp?",param,"FieldsCombo_div","getFormFlds_cbk");
            }
            function getFormFlds_cbk()
            {
                getObject("neetProcessingDivGroupedComp5").style.display = 'none';
            }
            function dosave(thisForm){
                getaddon("ajax/common.jsp?","doOn=formDetails&doThis=7&"+wrapformdata(thisForm),"FieldsComboResult_div","getoverview");
            }
        </script>
    </head>
    <body>
        <div id="wrap">
            <jsp:include page="/WEB-INF/jspf/header.jspf" flush="true" ></jsp:include>
            <div id="right">
                <%
                    if(session.getAttribute("currentUser") != null && session.getAttribute("currentUser").equals("admin")){
                %>
                <h1>Add Form Fields</h1>
                <form method="post" name="AEFFAFB" action="" onsubmit="return false;">
                    <table>
                        <tbody>
                            <tr>
                                <td>Group Name:</td><td><%= ulc.getAllGroups_Combo("groupId","","onchange='getGroupCompanies(this.value);'","") %></td>
                            </tr>
                            <tr>
                                <td>Company Name:</td>
                                <td>
                                    <div id="neetProcessingDivGroupedComp1" style='position:relative;display:none;'>
                                        <div style='position:absolute; top:0%; left:50%;'>
                                            <img alt=""  src='Image/icon_processing.gif' />
                                        </div>
                                    </div>
                                    <div id="companyCombo_div">
                                        <%= ulc.getAllCompanies_Combo("companyId","","","") %>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>Site Name:</td>
                                <td>
                                    <div id="neetProcessingDivGroupedComp2" style='position:relative;display:none;'>
                                        <div style='position:absolute; top:0%; left:50%;'>
                                            <img alt=""  src='Image/icon_processing.gif' />
                                        </div>
                                    </div>
                                    <div id="sitesCombo_div">
                                        <%= ulc.getAllSites_Combo("siteId","","","") %>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>Entity Name:</td>
                                <td>
                                    <div id="neetProcessingDivGroupedComp3" style='position:relative;display:none;'>
                                        <div style='position:absolute; top:0%; left:50%;'>
                                            <img alt=""  src='Image/icon_processing.gif' />
                                        </div>
                                    </div>
                                    <div id="EntityCombo_div">
                                        <%= ulc.getAllEntities_Combo("entityId","","","") %>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>Form Name:</td>
                                <td>
                                    <div id="neetProcessingDivGroupedComp4" style='position:relative;display:none;'>
                                        <div style='position:absolute; top:0%; left:50%;'>
                                            <img alt=""  src='Image/icon_processing.gif' />
                                        </div>
                                    </div>
                                    <div id="FormCombo_div">
                                        <%= ulc.getAllForms_Combo("formId","","","") %>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th>Form Elements:</th>
                                <th>Field Mapped to Database</th>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <div id="neetProcessingDivGroupedComp5" style='position:relative;display:none;'>
                                        <div style='position:absolute; top:0%; left:50%;'>
                                            <img alt=""  src='Image/icon_processing.gif' />
                                        </div>
                                    </div>
                                    <div id="FieldsCombo_div"></div>
                                    <div id="FieldsComboResult_div"></div>
                                </td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td colspan="2" align="left">
                                    <span style='color:red'>
                                        <bean:write name="AEFAFB" property="error" ignore="true" /><br/>
                                        <html:errors property="groupId" /><br/>
                                        <html:errors property="companyId" /><br/>
                                        <html:errors property="siteId" /><br/>
                                        <html:errors property="entityId" /><br/>
                                        <html:errors property="form_name" /><br/>
                                    </span>
                                </td>
                            </tr>
                        </tfoot>
                    </table>
                </form>
                <div id="messageFormFieldDelete_div">
                    <% if(session.getAttribute("messageFormFieldDelete") != null){
                            out.println(session.getAttribute("messageFormFieldDelete"));
                        }
                    %>
                </div>
                <br/>
                <br/>
                <div id="tabs">
                    <div id="neetProcessingDivtabsData" style='position:relative;'>
                        <div style='position:absolute; top:0%; left:50%;'>
                            <img alt=""  src='Image/icon_processing.gif' />
                        </div>
                    </div>
                </div>
                <%
                }
                else
                {
            %>
                    <jsp:include page="login.jsp" flush="true" ></jsp:include>
            <%
                }
            %>
        </div>
        <div id="left">
            <%
            //if(session.getAttribute("currentUser") != null){
            %>
                <jsp:include page="/WEB-INF/jspf/left_menu.jspf" flush="true" ></jsp:include>
            <%
            //}
            %>
        </div>
        <div style="clear: both;"> </div>
        <jsp:include page="/WEB-INF/jspf/footer.jspf" flush="true" ></jsp:include>
    </div>
    </body>
</html>